home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
scope
/
051-075
/
scopedisk66
/
pbg
/
pbg.asm
< prev
next >
Wrap
Assembly Source File
|
1995-03-19
|
4KB
|
144 lines
include "exec/types.i"
include "exec/ports.i"
include "exec/nodes.i"
include "exec/memory.i"
include "exec/io.i"
include "exec/tasks.i"
include "exec/interrupts.i"
include "devices/input.i"
include "exec/devices.i"
include "devices/inputevent.i"
XREF _AbsExecBase
XREF _LVODoIO
XREF _LVOOpenDevice
XREF _LVOCreateStdIO
XREF _LVOAllocSignal
XREF _LVOFindTask
XREF _LVOForbid
XREF _LVOPermit
XREF _LVOWait
move.l #MyInterrupt,a0
move.l #MyData,IS_DATA(a0)
move.l #MyCode,IS_CODE(a0)
move.b #51,LN_PRI(a0)
move.l #MyMsgPort,a0
move.b #NT_MSGPORT,LN_TYPE(a0)
movea.l _AbsExecBase,a6
move.l #0,a1
jsr _LVOFindTask(a6)
move.l d0,MyTask
movea.l _AbsExecBase,a6
move.l #-1,d0
jsr _LVOAllocSignal(a6)
move.l d0,MySigBit
move.l #MyMsgPort,a0
move.l MyTask,MP_SIGTASK(a0)
move.b MySigBit,MP_SIGBIT(a0)
move.b #PA_SIGNAL,MP_FLAGS(a0)
move.l #MyIOStdReq,a0
move.l #MyMsgPort,MN_REPLYPORT(a0)
move.b #NT_MESSAGE,LN_TYPE(a0)
movea.l _AbsExecBase,a6
move.l #DevName,a0
move.l #0,d0
move.l #MyIOStdReq,a1
move.l #0,d1
jsr _LVOOpenDevice(a6)
tst.l d0
bne Abort
move.l #MyIOStdReq,a0
move.w #IND_ADDHANDLER,IO_COMMAND(a0)
move.l #MyInterrupt,IO_DATA(a0)
movea.l _AbsExecBase,a6
move.l #MyIOStdReq,a1
jsr _LVODoIO(a6)
tst.l d0
bne Abort
Loop:
move.l _AbsExecBase,a6
move.l #$00,d0
jsr _LVOWait(a6) ;permanent wait
bra Loop ;just in case....
MyCode:
move.l a0,EV
movea.l _AbsExecBase,a6
jsr _LVOForbid(a6)
cmpi.b #IECLASS_RAWMOUSE,ie_Class(a0)
bne EndHandler
tst.w SpriteFlg
beq SkipClear
VertBlank:
move.w $dff01e,d0
andi.w #$0020,d0
beq VertBlank
move.w #$8020,$dff096 ;enable sprite DMA
clr.l Timer
clr.w SpriteFlg
bra SkipClear
EndHandler:
cmpi.l #100,Timer
beq SkipClear
addi.l #1,Timer
cmpi.l #100,Timer
bne SkipClear
move.w #1,SpriteFlg
VertBlank2:
move.w $dff01e,d0
andi.w #$0020,d0
beq VertBlank2
move.w #$0020,$dff096 ;disable sprite dma
SkipClear:
movea.l _AbsExecBase,a6
jsr _LVOPermit(a6)
move.l EV,a0
move.l EV,d0
rts
Abort:
clr.l d0
rts
MyInterrupt: dcb.b IS_SIZE,0
MyInputEvent: dcb.b ie_SIZEOF,0
MyIOStdReq: dcb.b IOSTD_SIZE,0
MyMsgPort: dcb.b MP_SIZE,0
MyMessage: dcb.b MN_SIZE,0
MyData: ds.l 512
DevName: dc.b 'input.device',0
cnop 0,2
EV ds.l 1
MyTask ds.l 1
MySigBit ds.l 1
Timer ds.l 1
SpriteFlg ds.w 1